package com.kymatrix.mpo.plus.bpm.server.dao.definition;

import com.kymatrix.mpo.plus.bpm.server.config.mybatis.mapper.BaseMapperX;
import com.kymatrix.mpo.plus.bpm.server.config.mybatis.query.LambdaQueryWrapperX;
import com.kymatrix.mpo.plus.bpm.server.model.entity.definition.BpmUserGroupEntity;
import com.kymatrix.mpo.plus.bpm.server.model.form.group.PageQueryBpmUserGroupReq;
import com.kymatrix.mpo.plus.common.business.common.PageResp;
import java.util.List;
import org.apache.ibatis.annotations.Mapper;

/**
 * 用户组 Mapper
 */
@Mapper
public interface BpmUserGroupMapper extends BaseMapperX<BpmUserGroupEntity> {

    default PageResp<BpmUserGroupEntity> selectPage(PageQueryBpmUserGroupReq reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<BpmUserGroupEntity>()
                .likeIfPresent(BpmUserGroupEntity::getName, reqVO.getName())
                .eqIfPresent(BpmUserGroupEntity::getStatus, reqVO.getStatus())
                .betweenIfPresent(BpmUserGroupEntity::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(BpmUserGroupEntity::getId));
    }

    default List<BpmUserGroupEntity> selectListByStatus(String status) {
        return selectList(BpmUserGroupEntity::getStatus, status);
    }

}
